import {
  getContent,
  checkSchool,
  checkEnterprise,
  checkShipowner,
} from "@/http/api";

function getCateFn(type) {
  let promise1 = new Promise((resolve, reject) => {
    getContent({ type: type }).then((res) => {
      if (res.data.code == 1) {
        let result = res.data.data;
        resolve(result);
      } else {
        resolve([]);
      }
    });
  });
  return promise1;
}
function getComList() {
  let promise1 = new Promise((resolve, reject) => {
    checkEnterprise().then((res) => {
      if (res.data.code == 1) {
        let result = res.data.data;
        resolve(result);
      } else {
        resolve([]);
      }
    });
  });
  return promise1;
}

function getBooterList() {
  let promise1 = new Promise((resolve, reject) => {
    checkShipowner().then((res) => {
      if (res.data.code == 1) {
        let result = res.data.data;
        resolve(result);
      } else {
        resolve([]);
      }
    });
  });
  return promise1;
}
function getSchoolList() {
  let promise1 = new Promise((resolve, reject) => {
    checkSchool().then((res) => {
      if (res.data.code == 1) {
        let result = res.data.data;
        resolve(result);
      } else {
        resolve([]);
      }
    });
  });
  return promise1;
}
export default {
  getCateFn,
  getComList,
  getSchoolList,
  getBooterList,
};
